package by.kniazhych.core.server.local.logic.peaces {
	import by.kniazhych.core.constants.PeaceType;
	import by.kniazhych.core.server.local.data.BoardData;
	import by.kniazhych.core.server.local.logic.LogicController;
	import flash.utils.Dictionary;
	
	/**
	 * ...
	 * @author Boutylin Mikhail
	 */
	
	
	
	public class PeaceLogicFactory{
		
		private var _hash:Dictionary = new Dictionary();
		private var _controller:LogicController;
		
		public function PeaceLogicFactory(controller:LogicController) {
			_controller = controller;
		}
		
		//--------------------------------------------------------------------------
		//
		//  PUBLIC METHODS
		//
		//--------------------------------------------------------------------------
		
		public function getPeace(type:uint):AbstractPeace {
			if (!_hash[type]) {
				_hash[type] = new _peaceTypes[type](_controller, type);
			}
			return _hash[type] as AbstractPeace;
		}
		
	}

}

//--------------------------------------------------------------------------
//
//  INNER DEFINITIONS
//
//--------------------------------------------------------------------------

import flash.utils.Dictionary;
import by.kniazhych.core.constants.PeaceType;
import by.kniazhych.core.server.local.logic.peaces.WhitePawn;
import by.kniazhych.core.server.local.logic.peaces.BlackPawn;
import by.kniazhych.core.server.local.logic.peaces.VaukalakPeace;
import by.kniazhych.core.server.local.logic.peaces.GarmataPeace;
import by.kniazhych.core.server.local.logic.peaces.LadziaPeace;
import by.kniazhych.core.server.local.logic.peaces.GetmanPeace;
import by.kniazhych.core.server.local.logic.peaces.KniazPeace;
import by.kniazhych.core.server.local.logic.peaces.KniazhychPeace;

const _peaceTypes:Dictionary = new Dictionary();
_peaceTypes[PeaceType.WHITE_PAWN] = WhitePawn;
_peaceTypes[PeaceType.BLACK_PAWN] = BlackPawn;

_peaceTypes[PeaceType.WHITE_VAUKALAK] = VaukalakPeace;
_peaceTypes[PeaceType.BLACK_VAUKALAK] = VaukalakPeace;

_peaceTypes[PeaceType.WHITE_GARMATA] = GarmataPeace;
_peaceTypes[PeaceType.BLACK_GARMATA] = GarmataPeace;

_peaceTypes[PeaceType.WHITE_LADZIA] = LadziaPeace;
_peaceTypes[PeaceType.BLACK_LADZIA] = LadziaPeace;

_peaceTypes[PeaceType.WHITE_GETMAN] = GetmanPeace;
_peaceTypes[PeaceType.BLACK_GETMAN] = GetmanPeace;

_peaceTypes[PeaceType.WHITE_KNIAZ] = KniazPeace;
_peaceTypes[PeaceType.BLACK_KNIAZ] = KniazPeace;

_peaceTypes[PeaceType.WHITE_KNIAZHYCH] = KniazhychPeace;
_peaceTypes[PeaceType.BLACK_KNIAZHYCH] = KniazhychPeace;

